#include <iostream>
#include <chrono>
#include <thread>
#include "StreamManager.h"


int main1()
{
    Stream::StreamInfo infoStream;
    //infoStream.bSavePic = true;
    infoStream.bSaveVideo = true;
    infoStream.nVideoTime = 60;
    infoStream.bRtmp = true;
    // input
    //infoStream.strInput = "rtsp://admin:Admin123@192.168.2.64:554";
    infoStream.strInput = "video.mp4";
    // the camera in notebook
    infoStream.strInput = "video=USB2.0 HD UVC WebCam";
    //infoStream.strInput = "video=USB2.0 PC CAMERA";

    // output
    //infoStream.strOutput = "test.mp4";
    infoStream.strOutput = "rtmp://127.0.0.1:1935/live/test";

    // hard device accelate
    infoStream.nHDType = Stream::kHWDeviceTypeNone;
    //infoStream.nHDType = Stream::kHWDeviceTypeCUDA;
    //infoStream.nHDType = Stream::kHWDeviceTypeDXVA2;

    //StreamMangement hStream(Stream::kStreamTypeRtsp);
    StreamMangement hStream(Stream::kStreamTypeUsb);
    hStream.ListDshowDevice();
    hStream.ListDshowDevice();
    hStream.StartDecode(infoStream);
    getchar();
    hStream.StopDecode();

    std::cout << "It'll exit in 3 seconds\n";
    std::this_thread::sleep_for(std::chrono::milliseconds(3000));
    return 0;
}